-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removeAttrs: Added optional value filter #977
Conversation
8f40cd0
to
90f8ba7
Compare
@GreLI How can we move this forward? Will pinging the original creator of this plugin help (@bennyschudel)? Thanks |
This would be a very useful addition to the plugin. |
plugins/removeAttrs.js
Outdated
@@ -81,12 +90,16 @@ exports.fn = function(item, params) { | |||
// prepare patterns | |||
var patterns = params.attrs.map(function(pattern) { | |||
|
|||
// apply to all elements if specifc element is omitted | |||
// if no element separators (:), assume it's attribute name, and apply to all elements and regardless of value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe should say "to all element regardless of value" (I just removed the extraneous 'and')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe but I was trying to emphasize that the plugin will make 2 assumptions if there are no separators, 1) match all elements and 2) match any value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe:
assume it's an attribute name, and apply the transformations to all elements (regardless of their value)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't parentheses imply "lesser importance" (e.g. afterthought)? Which is not exactly the message intended to convey.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you could state something like:
if no element separators (:), apply the pattern match against attribute name, otherwise matching on all elements and values
or
if no element separators (:), match on all elements and values applying the pattern match against attribute name specifically
Both would seem to express the functionality of the regex your join will result in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I too think this would be a nice addition to the plugin...Herman chimed in on my PR #999 which is a parity feature with grunt-svgstore and allows for using the SVG trick to style sprites with one more color by using the Here's an article I wrote on CSS tricks which explains the use case aforementioned: |
any plans to merge this PR in the near future? |
@deepsweet @GreLI Any way to get this moved through? |
Any way this can be merged in? |
It's hard to not wonder if SVGO is really maintained at this point with no feedback from core folk for nearly 6 months. It's such a good tool I certainly hope that is not the case. @Herman-Freund did you ever hear any feedback outside of this channel on your work? I can't see why we wouldn't want this feature added esp. given the positive comments from various people here. |
No 😕 Thanks everyone for the positive feedback! |
Merged in d23355e (there was a conflict with test from other PR). |
SVGO v1.2.0 has been just released! |
Example:
Remove all "fill" attributes that the value is "none"
Remove all "fill" attributes where the value is NOT "none"
Remove all "fill" attributes except when the value is white (white, #fff, rgb(255,255,255), etc.)